aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/(app)/invoice/[id]/tip
diff options
context:
space:
mode:
Diffstat (limited to 'src/routes/(app)/invoice/[id]/tip')
-rw-r--r--src/routes/(app)/invoice/[id]/tip/+page.svelte8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/routes/(app)/invoice/[id]/tip/+page.svelte b/src/routes/(app)/invoice/[id]/tip/+page.svelte
index 41cc4636..4be2f536 100644
--- a/src/routes/(app)/invoice/[id]/tip/+page.svelte
+++ b/src/routes/(app)/invoice/[id]/tip/+page.svelte
@@ -1,7 +1,4 @@
<script>
- import { untrack } from "svelte";
-
- import { browser } from "$app/environment";
import { fiat, invoice as inv, request } from "$lib/store";
import { loc, copy, focus, f, sat, get, s, sats } from "$lib/utils";
import Slider from "$comp/Slider.svelte";
@@ -78,7 +75,7 @@
let locale = $derived(loc(user));
let qr;
- let tipPercent = $state();
+ let tipPercent = $state(amount > 0 && tip > 0 ? (tip / amount) * 100 : 0);
let fullscreen;
@@ -86,8 +83,7 @@
let rate = invoice.rate * (data.rate / data.invoiceRate);
$effect(() => {
- if (typeof tipPercent === "undefined") tipPercent = (tip / amount) * 100;
- tip = Math.round((amount / 100) * untrack(() => tipPercent));
+ tip = Math.round((amount / 100) * tipPercent);
});
let amountFiat = $derived(parseFloat(((amount * rate) / sats).toFixed(2)));